#include "dategroupbox.h"
#include <QMouseEvent>
#include <QPainter>
dateGroupBox::dateGroupBox(QWidget *parent)
    : QGroupBox(parent)
{
    this->setMouseTracking(true);
    //自定义控件必须要自己设置好鼠标追踪，默认的控件则会继承。自定义的不会继承。
    //this->setStyleSheet(R"(QGroupBox{border:1px solid gray;})");
}

void dateGroupBox::paintEvent(QPaintEvent *event)
{
    QRect rect = this->rect();
    QPainter painter(this);
    QPen pen;
    pen.setWidth(1);
    pen.setColor(QColor(240, 240, 240));
    painter.setPen(pen);

    QPoint p1(rect.x(), (rect.x() + (rect.height() / 2)) - 20);
    QPoint p2(rect.x() + rect.width(), (rect.x() + (rect.height() / 2)) - 20);

    painter.drawLine(p1, p2);
}
